home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / thinkref / archive / THINKPascalUH2.1.sea / THINKPas Univ Hdr 2.1 / Interfaces / Printing.p < prev    next >
Text File  |  1995-09-12  |  13KB  |  481 lines

  1. { Converted with MPW2TPas Tuesday, September 12, 1995 8:52:50 PM }
  2. {
  3.      File:        Printing.p
  4.  
  5.      Contains:    Print Manager Interfaces.
  6.  
  7.      Version:    Technology:    System 7.5
  8.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  9.  
  10.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  14.                  stack.  Include the file and version information (from above)
  15.                  in the problem description and send to:
  16.                      Internet:    apple.bugs@applelink.apple.com
  17.                      AppleLink:    APPLE.BUGS
  18.  
  19. }
  20.  
  21.  UNIT Printing;
  22.  INTERFACE
  23.  
  24.  
  25. {$IFC UNDEFINED __PRINTING__}
  26. {$SETC __PRINTING__ := 1}
  27.  
  28.   USES
  29.    ConditionalMacros, Types, Errors, Quickdraw, Dialogs;
  30.  
  31. { $PUSH}
  32. { $ALIGN MAC68K}
  33. { $LibExport+}
  34.  
  35. CONST
  36.     iPFMaxPgs                    = 128;
  37.     iPrPgFract                    = 120;                            {Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract}
  38.     iPrPgFst                    = 1;                            {Page range constants}
  39.     iPrPgMax                    = 9999;
  40.     iPrRelease                    = 3;                            {Current version number of the code.}
  41.     iPrSavPFil                    = -1;
  42.     iPrAbort                    = $0080;
  43.     iPrDevCtl                    = 7;                            {The PrDevCtl Proc's ctl number}
  44.     lPrReset                    = $00010000;                    {The PrDevCtl Proc's CParam for reset}
  45.     lPrLineFeed                    = $00030000;
  46.     lPrLFStd                    = $0003FFFF;                    {The PrDevCtl Proc's CParam for std paper advance}
  47.     lPrLFSixth                    = $0003FFFF;
  48.     lPrPageEnd                    = $00020000;                    {The PrDevCtl Proc's CParam for end page}
  49.     lPrDocOpen                    = $00010000;
  50.     lPrPageOpen                    = $00040000;
  51.     lPrPageClose                = $00020000;
  52.     lPrDocClose                    = $00050000;
  53.     iFMgrCtl                    = 8;                            {The FMgr's Tail-hook Proc's ctl number}
  54.     iMscCtl                        = 9;                            {The FMgr's Tail-hook Proc's ctl number}
  55.     iPvtCtl                        = 10;                            {The FMgr's Tail-hook Proc's ctl number}
  56.  
  57.     pPrGlobals                    = $00000944;                    {The PrVars lo mem area:}
  58.     bDraftLoop                    = 0;
  59.     bSpoolLoop                    = 1;
  60.     bUser1Loop                    = 2;
  61.     bUser2Loop                    = 3;
  62.     fNewRunBit                    = 2;
  63.     fHiResOK                    = 3;
  64.     fWeOpenedRF                    = 4;
  65. {Driver constants }
  66.     iPrBitsCtl                    = 4;
  67.     lScreenBits                    = 0;
  68.     lPaintBits                    = 1;
  69.     lHiScreenBits                = $00000002;                    {The Bitmap Print Proc's Screen Bitmap param}
  70.     lHiPaintBits                = $00000003;                    {The Bitmap Print Proc's Paint [sq pix] param}
  71.     iPrIOCtl                    = 5;
  72.     iPrEvtCtl                    = 6;                            {The PrEvent Proc's ctl number}
  73.     lPrEvtAll                    = $0002FFFD;                    {The PrEvent Proc's CParam for the entire screen}
  74.     lPrEvtTop                    = $0001FFFD;                    {The PrEvent Proc's CParam for the top folder}
  75.     iPrDrvrRef                    = -3;
  76.  
  77.     getRslDataOp                = 4;
  78.     setRslOp                    = 5;
  79.     draftBitsOp                    = 6;
  80.     noDraftBitsOp                = 7;
  81.     getRotnOp                    = 8;
  82.     NoSuchRsl                    = 1;
  83.     OpNotImpl                    = 2;                            {the driver doesn't support this opcode}
  84.     RgType1                        = 1;
  85.  
  86.     feedCut                        = 0;
  87.     feedFanfold                    = 1;
  88.     feedMechCut                    = 2;
  89.     feedOther                    = 3;
  90.  
  91.     
  92. TYPE
  93.     TFeed = SInt8;
  94.  
  95.  
  96. CONST
  97.     scanTB                        = 0;
  98.     scanBT                        = 1;
  99.     scanLR                        = 2;
  100.     scanRL                        = 3;
  101.  
  102.     
  103. TYPE
  104.     TScan = SInt8;
  105.  
  106. { A Rect Ptr }
  107.     TPRect = ^Rect;
  108.  
  109.     PrIdleProcPtr = ProcPtr;  { PROCEDURE PrIdle; }
  110.     PrIdleUPP = UniversalProcPtr;
  111.  
  112. CONST
  113.     uppPrIdleProcInfo = $00000000; { PROCEDURE ; }
  114.  
  115. FUNCTION NewPrIdleProc(userRoutine: PrIdleProcPtr): PrIdleUPP;
  116.     {$IFC NOT GENERATINGCFM }
  117.     INLINE $2E9F;
  118.     {$ENDC}
  119.  
  120. PROCEDURE CallPrIdleProc(userRoutine: PrIdleUPP);
  121.     {$IFC NOT GENERATINGCFM}
  122.     INLINE $205F, $4E90;
  123.     {$ENDC}
  124. TYPE
  125.     PItemProcPtr = ProcPtr;  { PROCEDURE PItem(theDialog: DialogPtr; item: INTEGER); }
  126.     PItemUPP = UniversalProcPtr;
  127.  
  128. CONST
  129.     uppPItemProcInfo = $000002C0; { PROCEDURE (4 byte param, 2 byte param); }
  130.  
  131. FUNCTION NewPItemProc(userRoutine: PItemProcPtr): PItemUPP;
  132.     {$IFC NOT GENERATINGCFM }
  133.     INLINE $2E9F;
  134.     {$ENDC}
  135.  
  136. PROCEDURE CallPItemProc(theDialog: DialogPtr; item: INTEGER; userRoutine: PItemUPP);
  137.     {$IFC NOT GENERATINGCFM}
  138.     INLINE $205F, $4E90;
  139.     {$ENDC}
  140.  
  141. TYPE
  142.     TPrPort = RECORD
  143.         gPort:                    GrafPort;                                {The Printer's graf port.}
  144.         gProcs:                    QDProcs;                                {..and its procs}
  145.         lGParam1:                LONGINT;                                {16 bytes for private parameter storage.}
  146.         lGParam2:                LONGINT;
  147.         lGParam3:                LONGINT;
  148.         lGParam4:                LONGINT;
  149.         fOurPtr:                BOOLEAN;                                {Whether the PrPort allocation was done by us.}
  150.         fOurBits:                BOOLEAN;                                {Whether the BitMap allocation was done by us.}
  151.     END;
  152.  
  153.     TPPrPort = ^TPrPort;
  154.  
  155. { Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  156.   This is the "PrPeek" record. }
  157.     TPrInfo = RECORD
  158.         iDev:                    INTEGER;                                {Font mgr/QuickDraw device code}
  159.         iVRes:                    INTEGER;                                {Resolution of device, in device coordinates}
  160.         iHRes:                    INTEGER;                                {..note: V before H => compatable with Point.}
  161.         rPage:                    Rect;                                    {The page (printable) rectangle in device coordinates.}
  162.     END;
  163.  
  164.     TPPrInfo = ^TPrInfo;
  165.  
  166. { Print Info Record: The parameters needed for page composition. }
  167.     TPrStl = RECORD
  168.         wDev:                    INTEGER;
  169.         iPageV:                    INTEGER;
  170.         iPageH:                    INTEGER;
  171.         bPort:                    SInt8;
  172.         feed:                    TFeed;
  173.     END;
  174.  
  175.     TPPrStl = ^TPrStl;
  176.  
  177.     TPrXInfo = RECORD
  178.         iRowBytes:                INTEGER;
  179.         iBandV:                    INTEGER;
  180.         iBandH:                    INTEGER;
  181.         iDevBytes:                INTEGER;
  182.         iBands:                    INTEGER;
  183.         bPatScale:                SInt8;
  184.         bUlThick:                SInt8;
  185.         bUlOffset:                SInt8;
  186.         bUlShadow:                SInt8;
  187.         scan:                    TScan;
  188.         bXInfoX:                SInt8;
  189.     END;
  190.  
  191.     TPPrXInfo = ^TPrXInfo;
  192.  
  193.     TPrJob = RECORD
  194.         iFstPage:                INTEGER;                                {Page Range.}
  195.         iLstPage:                INTEGER;
  196.         iCopies:                INTEGER;                                {No. copies.}
  197.         bJDocLoop:                SInt8;                                    {The Doc style: Draft, Spool, .., and ..}
  198.         fFromUsr:                BOOLEAN;                                {Printing from an User's App (not PrApp) flag}
  199.         pIdleProc:                PrIdleUPP;                                {The Proc called while waiting on IO etc.}
  200.         pFileName:                StringPtr;                                {Spool File Name: NIL for default.}
  201.         iFileVol:                INTEGER;                                {Spool File vol, set to 0 initially}
  202.         bFileVers:                SInt8;                                    {Spool File version, set to 0 initially}
  203.         bJobX:                    SInt8;                                    {An eXtra byte.}
  204.     END;
  205.  
  206.     TPPrJob = ^TPrJob;
  207.  
  208. { Print Job: Print "form" for a single print request. }
  209.     TPrFlag1 = PACKED RECORD
  210.         f15:                    BOOLEAN;
  211.         f14:                    BOOLEAN;
  212.         f13:                    BOOLEAN;
  213.         f12:                    BOOLEAN;
  214.         f11:                    BOOLEAN;
  215.         f10:                    BOOLEAN;
  216.         f9:                        BOOLEAN;
  217.         f8:                        BOOLEAN;
  218.         f7:                        BOOLEAN;
  219.         f6:                        BOOLEAN;
  220.         f5:                        BOOLEAN;
  221.         f4:                        BOOLEAN;
  222.         f3:                        BOOLEAN;
  223.         f2:                        BOOLEAN;
  224.         fLstPgFst:                BOOLEAN;
  225.         fUserScale:                BOOLEAN;
  226.     END;
  227.  
  228.     TPrint = RECORD
  229.         iPrVersion:                INTEGER;                                {(2) Printing software version}
  230.         prInfo:                    TPrInfo;                                {(14) the PrInfo data associated with the current style.}
  231.         rPaper:                    Rect;                                    {(8) The paper rectangle [offset from rPage]}
  232.         prStl:                    TPrStl;                                    {(8)  This print request's style.}
  233.         prInfoPT:                TPrInfo;                                {(14)  Print Time Imaging metrics}
  234.         prXInfo:                TPrXInfo;                                {(16)  Print-time (expanded) Print info record.}
  235.         prJob:                    TPrJob;                                    {(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120}
  236.         CASE INTEGER OF
  237.         0: (
  238.             printX:                        ARRAY [1..19] OF INTEGER;
  239.            );
  240.         1: (
  241.             prFlag1:                    TPrFlag1;
  242.             iZoomMin:                    INTEGER;
  243.             iZoomMax:                    INTEGER;
  244.             hDocName:                    StringHandle;
  245.            );
  246.     END;
  247.  
  248.     TPPrint = ^TPrint;
  249.     THPrint = ^TPPrint;
  250.  
  251. { The universal 120 byte printing record }
  252.     TPrStatus = RECORD
  253.         iTotPages:                INTEGER;                                {Total pages in Print File.}
  254.         iCurPage:                INTEGER;                                {Current page number}
  255.         iTotCopies:                INTEGER;                                {Total copies requested}
  256.         iCurCopy:                INTEGER;                                {Current copy number}
  257.         iTotBands:                INTEGER;                                {Total bands per page.}
  258.         iCurBand:                INTEGER;                                {Current band number}
  259.         fPgDirty:                BOOLEAN;                                {True if current page has been written to.}
  260.         fImaging:                BOOLEAN;                                {Set while in band's DrawPic call.}
  261.         hPrint:                    THPrint;                                {Handle to the active Printer record}
  262.         pPrPort:                TPPrPort;                                {Ptr to the active PrPort}
  263.         hPic:                    PicHandle;                                {Handle to the active Picture}
  264.     END;
  265.  
  266.     TPPrStatus = ^TPrStatus;
  267.  
  268. { Print Status: Print information during printing. }
  269.     TPfPgDir = RECORD
  270.         iPages:                    INTEGER;
  271.         iPgPos:                    ARRAY [0..128] OF LONGINT;                {ARRAY [0..128] OF LONGINT}
  272.     END;
  273.  
  274.     TPPfPgDir = ^TPfPgDir;
  275.     THPfPgDir = ^TPPfPgDir;
  276.  
  277. { PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) }
  278. { This is the Printing Dialog Record. Only used by folks appending their own
  279.    DITLs to the print dialogs.    Print Dialog: The Dialog Stream object. }
  280. {$IFC STRICT_WINDOWS }
  281.     TPPrDlgRef = Ptr;
  282.  
  283. {$ELSEC}
  284.     TPrDlg = RECORD
  285.         Dlg:                    DialogRecord;                            {The Dialog window}
  286.         pFltrProc:                ModalFilterUPP;                            {The Filter Proc.}
  287.         pItemProc:                PItemUPP;                                {The Item evaluating proc.}
  288.         hPrintUsr:                THPrint;                                {The user's print record.}
  289.         fDoIt:                    BOOLEAN;
  290.         fDone:                    BOOLEAN;
  291.         lUser1:                    LONGINT;                                {Four longs for apps to hang global data.}
  292.         lUser2:                    LONGINT;                                {Plus more stuff needed by the particular}
  293.         lUser3:                    LONGINT;                                {printing dialog.}
  294.         lUser4:                    LONGINT;
  295.     END;
  296.  
  297.     TPPrDlg = ^TPrDlg;
  298.  
  299.     TPPrDlgRef = ^TPrDlg;
  300.  
  301. {$ENDC}
  302.     PDlgInitProcPtr = ProcPtr;  { FUNCTION PDlgInit(hPrint: THPrint): TPPrDlgRef; }
  303.     PDlgInitUPP = UniversalProcPtr;
  304.  
  305. CONST
  306.     uppPDlgInitProcInfo = $000000F0; { FUNCTION (4 byte param): 4 byte result; }
  307.  
  308. FUNCTION NewPDlgInitProc(userRoutine: PDlgInitProcPtr): PDlgInitUPP;
  309.     {$IFC NOT GENERATINGCFM }
  310.     INLINE $2E9F;
  311.     {$ENDC}
  312.  
  313. FUNCTION CallPDlgInitProc(hPrint: THPrint; userRoutine: PDlgInitUPP): TPPrDlgRef;
  314.     {$IFC NOT GENERATINGCFM}
  315.     INLINE $205F, $4E90;
  316.     {$ENDC}
  317.  
  318. TYPE
  319.     TGnlData = RECORD
  320.         iOpCode:                INTEGER;
  321.         iError:                    INTEGER;
  322.         lReserved:                LONGINT;                                {more fields here depending on call}
  323.     END;
  324.  
  325.     TRslRg = RECORD
  326.         iMin:                    INTEGER;
  327.         iMax:                    INTEGER;
  328.     END;
  329.  
  330.     TRslRec = RECORD
  331.         iXRsl:                    INTEGER;
  332.         iYRsl:                    INTEGER;
  333.     END;
  334.  
  335.     TGetRslBlk = RECORD
  336.         iOpCode:                INTEGER;
  337.         iError:                    INTEGER;
  338.         lReserved:                LONGINT;
  339.         iRgType:                INTEGER;
  340.         xRslRg:                    TRslRg;
  341.         yRslRg:                    TRslRg;
  342.         iRslRecCnt:                INTEGER;
  343.         rgRslRec:                ARRAY [1..27] OF TRslRec;
  344.     END;
  345.  
  346.     TSetRslBlk = RECORD
  347.         iOpCode:                INTEGER;
  348.         iError:                    INTEGER;
  349.         lReserved:                LONGINT;
  350.         hPrint:                    THPrint;
  351.         iXRsl:                    INTEGER;
  352.         iYRsl:                    INTEGER;
  353.     END;
  354.  
  355.     TDftBitsBlk = RECORD
  356.         iOpCode:                INTEGER;
  357.         iError:                    INTEGER;
  358.         lReserved:                LONGINT;
  359.         hPrint:                    THPrint;
  360.     END;
  361.  
  362.     TGetRotnBlk = RECORD
  363.         iOpCode:                INTEGER;
  364.         iError:                    INTEGER;
  365.         lReserved:                LONGINT;
  366.         hPrint:                    THPrint;
  367.         fLandscape:                BOOLEAN;
  368.         bXtra:                    SInt8;
  369.     END;
  370.  
  371.  
  372. PROCEDURE PrPurge;
  373.     {$IFC NOT GENERATINGCFM}
  374.     INLINE $2F3C, $A800, $0000, $A8FD;
  375.     {$ENDC}
  376. PROCEDURE PrNoPurge;
  377.     {$IFC NOT GENERATINGCFM}
  378.     INLINE $2F3C, $B000, $0000, $A8FD;
  379.     {$ENDC}
  380. PROCEDURE PrOpen;
  381.     {$IFC NOT GENERATINGCFM}
  382.     INLINE $2F3C, $C800, $0000, $A8FD;
  383.     {$ENDC}
  384. PROCEDURE PrClose;
  385.     {$IFC NOT GENERATINGCFM}
  386.     INLINE $2F3C, $D000, $0000, $A8FD;
  387.     {$ENDC}
  388. PROCEDURE PrintDefault(hPrint: THPrint);
  389.     {$IFC NOT GENERATINGCFM}
  390.     INLINE $2F3C, $2004, $0480, $A8FD;
  391.     {$ENDC}
  392. FUNCTION PrValidate(hPrint: THPrint): BOOLEAN;
  393.     {$IFC NOT GENERATINGCFM}
  394.     INLINE $2F3C, $5204, $0498, $A8FD;
  395.     {$ENDC}
  396. FUNCTION PrStlDialog(hPrint: THPrint): BOOLEAN;
  397.     {$IFC NOT GENERATINGCFM}
  398.     INLINE $2F3C, $2A04, $0484, $A8FD;
  399.     {$ENDC}
  400. FUNCTION PrJobDialog(hPrint: THPrint): BOOLEAN;
  401.     {$IFC NOT GENERATINGCFM}
  402.     INLINE $2F3C, $3204, $0488, $A8FD;
  403.     {$ENDC}
  404. FUNCTION PrStlInit(hPrint: THPrint): TPPrDlgRef;
  405.     {$IFC NOT GENERATINGCFM}
  406.     INLINE $2F3C, $3C04, $040C, $A8FD;
  407.     {$ENDC}
  408. FUNCTION PrJobInit(hPrint: THPrint): TPPrDlgRef;
  409.     {$IFC NOT GENERATINGCFM}
  410.     INLINE $2F3C, $4404, $0410, $A8FD;
  411.     {$ENDC}
  412. PROCEDURE PrJobMerge(hPrintSrc: THPrint; hPrintDst: THPrint);
  413.     {$IFC NOT GENERATINGCFM}
  414.     INLINE $2F3C, $5804, $089C, $A8FD;
  415.     {$ENDC}
  416. FUNCTION PrDlgMain(hPrint: THPrint; pDlgInit: PDlgInitUPP): BOOLEAN;
  417.     {$IFC NOT GENERATINGCFM}
  418.     INLINE $2F3C, $4A04, $0894, $A8FD;
  419.     {$ENDC}
  420. FUNCTION PrOpenDoc(hPrint: THPrint; pPrPort: TPPrPort; pIOBuf: Ptr): TPPrPort;
  421.     {$IFC NOT GENERATINGCFM}
  422.     INLINE $2F3C, $0400, $0C00, $A8FD;
  423.     {$ENDC}
  424. PROCEDURE PrCloseDoc(pPrPort: TPPrPort);
  425.     {$IFC NOT GENERATINGCFM}
  426.     INLINE $2F3C, $0800, $0484, $A8FD;
  427.     {$ENDC}
  428. PROCEDURE PrOpenPage(pPrPort: TPPrPort; pPageFrame: TPRect);
  429.     {$IFC NOT GENERATINGCFM}
  430.     INLINE $2F3C, $1000, $0808, $A8FD;
  431.     {$ENDC}
  432. PROCEDURE PrClosePage(pPrPort: TPPrPort);
  433.     {$IFC NOT GENERATINGCFM}
  434.     INLINE $2F3C, $1800, $040C, $A8FD;
  435.     {$ENDC}
  436. PROCEDURE PrPicFile(hPrint: THPrint; pPrPort: TPPrPort; pIOBuf: Ptr; pDevBuf: Ptr; VAR prStatus: TPrStatus);
  437.     {$IFC NOT GENERATINGCFM}
  438.     INLINE $2F3C, $6005, $1480, $A8FD;
  439.     {$ENDC}
  440. FUNCTION PrError: INTEGER;
  441.     {$IFC NOT GENERATINGCFM}
  442.     INLINE $2F3C, $BA00, $0000, $A8FD;
  443.     {$ENDC}
  444. PROCEDURE PrSetError(iErr: INTEGER);
  445.     {$IFC NOT GENERATINGCFM}
  446.     INLINE $2F3C, $C000, $0200, $A8FD;
  447.     {$ENDC}
  448. PROCEDURE PrGeneral(pData: Ptr);
  449.     {$IFC NOT GENERATINGCFM}
  450.     INLINE $2F3C, $7007, $0480, $A8FD;
  451.     {$ENDC}
  452. PROCEDURE PrDrvrOpen;
  453.     {$IFC NOT GENERATINGCFM}
  454.     INLINE $2F3C, $8000, $0000, $A8FD;
  455.     {$ENDC}
  456. PROCEDURE PrDrvrClose;
  457.     {$IFC NOT GENERATINGCFM}
  458.     INLINE $2F3C, $8800, $0000, $A8FD;
  459.     {$ENDC}
  460. PROCEDURE PrCtlCall(iWhichCtl: INTEGER; lParam1: LONGINT; lParam2: LONGINT; lParam3: LONGINT);
  461.     {$IFC NOT GENERATINGCFM}
  462.     INLINE $2F3C, $A000, $0E00, $A8FD;
  463.     {$ENDC}
  464. FUNCTION PrDrvrDCE: Handle;
  465.     {$IFC NOT GENERATINGCFM}
  466.     INLINE $2F3C, $9400, $0000, $A8FD;
  467.     {$ENDC}
  468. FUNCTION PrDrvrVers: INTEGER;
  469.     {$IFC NOT GENERATINGCFM}
  470.     INLINE $2F3C, $9A00, $0000, $A8FD;
  471.     {$ENDC}
  472.  
  473. { $ALIGN RESET}
  474. { $POP}
  475.  
  476. {$ENDC} {__PRINTING__}
  477.  
  478.  IMPLEMENTATION
  479.  END.
  480.  
  481.